home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.9 KB | 147 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Content.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef FWKIND_H
- #include "FWKind.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- #ifndef FWSUUTIL_H
- #include "FWSUUtil.h"
- #endif
-
- #ifndef FWRESOUR_H
- #include "FWResour.h"
- #endif
-
- //========================================================================================
- // Runtime information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfclock
- #endif
-
- //========================================================================================
- // Class CClockContent
- //========================================================================================
-
- FW_DEFINE_AUTO(CClockContent)
-
- //----------------------------------------------------------------------------------------
- // CClockContent constructor
- //----------------------------------------------------------------------------------------
-
- CClockContent::CClockContent(Environment* ev, FW_CPart* part) :
- FW_CContent(ev, part),
- fHasTickSound(false),
- fHasChimeSound(true)
- {
- // ----- Load the face string ("ODF") -----
- FW_PSharedLibraryResourceFile resFile(ev);
- ::FW_LoadStringByID(ev, resFile, kClockFaceStrings, FW_kMultiStringRes, kClockOpenDocString, fFaceString);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CClockContent destructor
- //----------------------------------------------------------------------------------------
-
- CClockContent::~CClockContent()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // CClockContent::ExternalizeKind
- //----------------------------------------------------------------------------------------
-
- void CClockContent::ExternalizeKind(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CKind* kind,
- FW_StorageKinds storageKind,
- FW_CPromise* promise,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(cloneInfo);
- FW_UNUSED(storageKind);
- FW_UNUSED(promise);
-
- short dummy = 0;
- short hoursOffset;
-
- FW_ASSERT(kind->IsPartKind(ev));
-
- FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, kind->GetType(ev));
- FW_CWritableStream stream(suSink);
- stream << dummy; // to keep compatibility
- stream << fHasTickSound;
- stream << fHasChimeSound;
-
- hoursOffset = fTimeOffset.GetHours();
- stream << hoursOffset;
- stream << fFaceString;
-
- // ----- Clear the end of the value -----
- FW_SUDeleteEndOfFocusedValue(ev, storageUnit);
- }
-
- //----------------------------------------------------------------------------------------
- // CClockContent::InternalizeKind
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CClockContent::InternalizeKind(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CKind* kind,
- FW_StorageKinds storageKind,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(cloneInfo);
- FW_UNUSED(storageKind);
-
- short dummy, hoursOffset;
-
- FW_ASSERT(kind->IsPartKind(ev));
-
- FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, kind->GetType(ev));
- FW_PBufferedSink sink(ev, suSink);
- FW_CReadableStream stream(sink);
- stream >> dummy; // to keep compatibility
- stream >> fHasTickSound;
- stream >> fHasChimeSound;
-
- stream >> hoursOffset; // offset, in hours
- stream >> fFaceString;
- // FW_CTimeSpan(long days, short hours, short minutes, short seconds);
- FW_CTimeSpan offset(0, hoursOffset, 0, 0);
- fTimeOffset = offset;
-
- return true;
- }
-
-